﻿using ChiWalker.Dynamics;
using ChiWalker.Helpers;
using ChiWalker.Spell;
using ChiWalker.Utilities;
using Styx;
using Styx.TreeSharp;

namespace ChiWalker.Routines.Shaman
{
    internal class Elemental
    {
        [Behavior(BehaviorType.Combat | BehaviorType.Pull)]
        [Spec(WoWSpec.ShamanElemental)]
        [Class(WoWClass.Shaman)]
        public static Composite ElementalShaman()

        {
            return new PrioritySelector(
                Safers.EnsureTarget(),
                WaitFor.WaitForCast(),
                Movement.MoveToLoS(ret => StyxWoW.Me.CurrentTarget),
                Movement.FaceMyTarget(),
                new CastOnSelf(Spell.HealingSurge, ret => StyxWoW.Me.HealthPercent <= 80),
                new CastOnMyTarget(Spell.FlameShock,
                    ret => StyxWoW.Me.CurrentTarget.GetAuraTimeLeft(Spell.FlameShock, true).TotalSeconds <= 3),
                new CastOnMyTarget(Spell.LavaBurst),
                new CastOnMyTarget(Spell.ElementalBlast),
                new CastOnMyTarget(Spell.EarthShock,
                    ret =>
                        StyxWoW.Me.HasAura(Spell.LightningShield) &&
                        StyxWoW.Me.GetAuraById(Spell.LightningShield).StackCount >= 6),
                new CastOnMyTarget(Spell.LightningBolt),
                Movement.MoveToUnit(ret => StyxWoW.Me.CurrentTarget)
                );
        }
    }
}